package com.transaction.manage.controller;

import com.transaction.common.base.BaseController;
import com.transaction.manage.model.vo.ComboboxVo;
import com.transaction.manage.service.ComboboxService;
import com.transaction.manage.service.TaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

@RequestMapping("/combobox")
@RestController
@ApiIgnore
public class ComboboxController extends BaseController {


    @Autowired
    private ComboboxService comboboxService;

    @Autowired
    private TaService taService;

    /**
     * 根据渠道编码查询产品信息
     * @return
     */
    @GetMapping("/selectFundInfoCombobox")
    public Object selectFundInfoCombobox(String channelCode){
        List<ComboboxVo> list = comboboxService.selectValidFundInfoCombobox(channelCode);
        return retResultVo(list);
    }

    @GetMapping("/selectSubChannelCodeCombobox")
    public Object selectSubChannelCodeCombobox(String channelCode){
        List<ComboboxVo> list = taService.getSubChannelCodeCombobox(channelCode);
        return retResultVo(list);
    }

    @GetMapping("/selectFundYieldTypeCombobox")
    public Object selectFundYieldTypeCombobox(String channelCode,String fundCode){
        List<ComboboxVo> list = taService.getFundYieldTypes(channelCode,fundCode);
        return retResultVo(list);
    }

    @GetMapping("/selectFundYieldCombobox")
    public Object selectFundYieldCombobox(String channelCode,String fundCode){
        List<ComboboxVo> list = taService.getFundYields(channelCode,fundCode);
        return retResultVo(list);
    }

    @GetMapping("/selectTransRateFundInfoCombobox")
    public Object selectTransRateFundInfoCombobox(String channelCode){
        List<ComboboxVo> list = comboboxService.selectTransRateFundInfoCombobox(channelCode);
        return retResultVo(list);
    }

    @GetMapping("/selectAllChildrenCombobox")
    public Object selectAllChildrenCombobox(String parentKey){
        List<ComboboxVo> list = comboboxService.selectAllChildrenByDictKey(parentKey);
        return retResultVo(list);
    }

    @GetMapping("/selectOpenFundInfoCombobox")
    public Object selectOpenFundInfoCombobox(String channelCode){
        List<ComboboxVo> list = comboboxService.selectOpenFundInfoCombobox(channelCode);
        return retResultVo(list);
    }

}
